/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ejercicio.practica3;

/**
 *
 * @author manolo
 */
public class Hilo extends Thread {

    private static int n;
    private boolean flag;

    public Hilo(boolean flag) {
        this.flag = flag;
    }

    @Override
    public void run() {
        if (flag == true) {
            for (int i = 0; i < 1000; i++) {
                System.out.println(n);
                n++;
            }
        } else {
            for (int i = 0; i < 1000; i++) {
                System.out.println(n);
                n--;
            }
        }
    }

    /**
     * Get the value of n
     *
     * @return the value of n
     */
    public static int getN() {
        return n;
    }

    /**
     * Set the value of n
     *
     * @param n new value of n
     */
    public static void setN(int n) {
        Hilo.n = n;
    }

}
